<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/common/taglibs.jsp"%>
<script type="text/javascript"	src="${ctx}/resources/js/datatable-query.js"></script>

<div class="row-fluid">
	<div class="span12">
		<div class="box gradient">
			<div class="title">
				<h4>
					<span>Archive   </span>
				</h4>
				<a href="#" class="minimize">Minimize</a>
			</div>
			<div class="content scrollable clearfix">
				<table class="ajaxTable display table table-bordered">
					<thead>
						<tr>
							<th><a id="select_all"><span
									class="icomoon-icon-checkmark-2"></span></a></th>
							<th>From</th>
							<th>To</th>
							<th>Count</th>
							<th>Action</th>
						</tr>
					</thead>
				</table>
			</div>
		</div>

	</div>

</div>
<script type="text/javascript">

$(document).ready(function () {
	johnny.oTable = $('.ajaxTable').dataTable({
		"bLengthChange": true,
		"aoColumnDefs": [
			       		 { 'bSortable': false, 'aTargets': [0,4] }
			       		],
		"sAjaxSource": '${ctx}/admin/base-blog-archive/',
		"fnInitComplete": function (oSettings, json) { }
	});
	var name = $("<input>").attr({
		type: "text",
		field: "title",
		op: "cn",
		placeholder: "Title",
		class: "filterdata"
	});
	johnny.initTableQuery(name);
	var config = {
			id : 'del',
			text  : 'Del',
			domain : "Calendar Event",
			operation : "Delete",
			url : "${ctx}/admin/base-blog-archive/del/"
	};
	johnny.tableBtn(config);

	
});
 

var columnHeader = ['','fromTime','toTime', 'count'];
var QueryData = function (aoData) {
	return johnny.initQueryData(aoData, columnHeader);
}

var DataTableForm = function (json, echo) {
	var dataArray = new Array();
	for (var i = 0; i < json.result.length; i++) {
		var subArray = new Array();
		var link = "${ctx}/admin/base-blog-archive/"+json.result[i].id+"/edit/";
		var value = johnny.getForSelect(json.result[i].id);
 		subArray.push(value);
		subArray.push(json.result[i].fromTime);
		subArray.push(json.result[i].toTime);
		subArray.push(json.result[i].count);
  		subArray.push(johnny.getEditHtml(link));
		dataArray.push(subArray);
	}
	return {
		sEcho: echo,
		iTotalRecords: json.totalCount,
		iTotalDisplayRecords: json.totalCount,
		aaData: dataArray
	};
}
</script>
<div id="newBannerGroup" class="modal hide fade" style="display: none;">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">
			<span class="icon12 minia-icon-close"></span>
		</button>
		<h3>New Banner Group</h3>
	</div>
	<div class="modal-body">
		<form method="post" id="bannerGroupForm">
			<div class="form-row row-fluid">
				<label class="form-label span4">Name</label> <input class="span8"
					name="name" />
			</div>
			<div class="form-row row-fluid">
				<label class="form-label span4">Description</label> <input
					class="span8" name="description" />
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">Close</a> <a href="#"
			id="confirmBannerGroup" class="btn btn-primary">Save changes</a>
	</div>
</div>